//
//  FirstShouYinViewController.m
//  EJLX
//
//  Created by xufei on 15/12/9.
//  Copyright © 2015年 江苏一键联信息科技有限公司. All rights reserved.
//

#import "FirstShouYinViewController.h"
#import "shouYinTaiViewController.h"
@interface FirstShouYinViewController ()

@end

@implementation FirstShouYinViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor=[UIColor whiteColor];
    UIView*view=[[UIView alloc]initWithFrame:CGRectMake(0,20,WIDE, 44)];
    view.backgroundColor=RGB_COLOR(0x00c49f);
    [self.view addSubview:view];
    UIButton*backBut=[[UIButton alloc]initWithFrame:CGRectMake(10,7,30,30)];
    [backBut setImage:[UIImage imageNamed:@"返回箭头"] forState:UIControlStateNormal];
    [backBut addTarget:self action:@selector(butClick) forControlEvents:UIControlEventTouchUpInside];
    [view addSubview:backBut];
    UILabel*label=[[UILabel alloc]initWithFrame:CGRectMake(WIDE/2-50, 10,100, 24)];
    label.text=@"020收银台";
    label.textColor=[UIColor whiteColor];
    [view addSubview:label];

   
    // Do any additional setup after loading the view from its nib.
}
-(void)butClick
{
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
    // Check for non-numeric characters
    NSUInteger lengthOfString = string.length;
    for (NSInteger loopIndex = 0; loopIndex < lengthOfString; loopIndex++) {//只允许数字输入
        unichar character = [string characterAtIndex:loopIndex];
        if (character < 48) return NO; // 48 unichar for 0
        if (character > 57) return NO; // 57 unichar for 9
    }
    // Check for total length
    NSUInteger proposedNewLength = textField.text.length - range.length + string.length;
    if (proposedNewLength > 1000) return NO;//限制长度
    return YES;
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (IBAction)sender:(UIButton *)sender

{
    if ([_textfield.text length])
    {
        shouYinTaiViewController*vc=[[shouYinTaiViewController alloc]init];
        vc.mony=_textfield.text;
        vc.o2o=@"ture";
        [self.navigationController pushViewController:vc animated:YES];
    }
    else{
        SHOW_ALERT(@"请输入金额");
    }
    
}
@end
